<?php

/**
 * TicketCaisse form base class.
 *
 * @method TicketCaisse getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTicketCaisseForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'id_session'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SessionCaisse'), 'add_empty' => true)),
      'montant_total'    => new sfWidgetFormInputText(),
      'num_ticket'       => new sfWidgetFormInputText(),
      'montant_recu'     => new sfWidgetFormInputText(),
      'id_reglement'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ReglementClient'), 'add_empty' => true)),
      'id_factureClient' => new sfWidgetFormInputText(),
      'total_ht'         => new sfWidgetFormInputText(),
      'total_ttc'        => new sfWidgetFormInputText(),
      'montant_tva'      => new sfWidgetFormInputText(),
      'montant_remise'   => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'deleted_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_session'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SessionCaisse'), 'required' => false)),
      'montant_total'    => new sfValidatorNumber(array('required' => false)),
      'num_ticket'       => new sfValidatorString(array('max_length' => 225, 'required' => false)),
      'montant_recu'     => new sfValidatorNumber(array('required' => false)),
      'id_reglement'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ReglementClient'), 'required' => false)),
      'id_factureClient' => new sfValidatorInteger(array('required' => false)),
      'total_ht'         => new sfValidatorNumber(array('required' => false)),
      'total_ttc'        => new sfValidatorNumber(array('required' => false)),
      'montant_tva'      => new sfValidatorNumber(array('required' => false)),
      'montant_remise'   => new sfValidatorNumber(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
      'deleted_at'       => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ticket_caisse[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TicketCaisse';
  }

}
